import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class Detail extends StatefulWidget {
  _ContentWidgetState createState() => new _ContentWidgetState();
}

class _ContentWidgetState extends State<Detail> {
  EventChannel eventChannel =
      EventChannel("channel_detail", const StandardMethodCodec());

  // 初始化传参
  _initWithPrama() {
    eventChannel.receiveBroadcastStream("init").listen((Object value) {
      print("原生传给Flutter的值:$value");
    }, onError: (dynamic a) {
      print("init:参数接收失败");
    });
  }

  @override
  void initState() {
    super.initState();
    _initWithPrama();
  }

  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
        appBar: AppBar(
          title: Text('Flutter详情页面'),
        ),
        body: Center(
          child: Center(
            child: Text('Flutter详情页面'),
          ),
        ));
  }
}
